home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4070 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. Path: news.Stanford.EDU!not-for-mail
  2. From: brien@leland.Stanford.EDU (brien oberstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Copy constructing an already default constructed object
  5. Date: 27 Jan 1996 10:23:17 -0800
  6. Organization: Stanford University
  7. Message-ID: <4edqil$7ub@elaine11.Stanford.EDU>
  8. References: <4e906b$stk@elaine32.Stanford.EDU> <4eaosg$ab7@news.bridge.net>
  9. NNTP-Posting-Host: elaine11.stanford.edu
  10. X-Newsreader: NN version 6.5.0 (NOV)
  11.  
  12. David Byrden <100101.2547@compuserve.com> writes:
  13.  
  14.  
  15. >>> I'd like to know what people think of the solution I've reached.
  16.  
  17. >No offence, but you genuinely do not know what you are doing. I recommend 
  18. >some serious study of worked examples of C++.
  19.  
  20. Thanks Dave.  I value your opinion.
  21.  
  22.  
  23. >For example, you should never use memcpy to copy C++ objects. There are 
  24. >many reasons.
  25.  
  26. Ok.  Name one besides the vtable pointer.  Put up or shut up.
  27.  
  28.  
  29. >I simply can't understand why it is that you won't write an assignment 
  30. >operator like this;
  31.  
  32. >A& operator=( const A&* other )
  33. >{
  34. >    return if assigning self to self
  35. >    do what the dtor does
  36. >    do what the copy ctor does
  37. >    return *this
  38. >}
  39.  
  40. Can you say "duplicating code" all over the place.
  41. And the real problem is that I've got objects
  42. within objects which need to be initialized in the
  43. ctor initialization list so I can't share a single
  44. function.
  45.  
  46. >This is the basic model for an assignment operator, although it usually 
  47. >can be internally optimised
  48.  
  49.  
  50. >>> I figure that this type of shit is common enough
  51. >C++ is not the only language where you need improvements.
  52.  
  53. Thanks again.  Next time I'll post my mother fuckin article
  54. to comp.lang.english first and see if everyone approves.
  55.  
  56. dickhead.
  57.  
  58. -brien
  59.  
  60.